﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MMITDomain.Abstract;
using MMITDomain.Entities;

namespace MMITDomain.Concrete
{
    public class EFIdentificationTypeRepository : IIdentificationTypeRepository
    {
        EFDbContext dbContext = new EFDbContext();

        #region IIdentificationTypeRepository Members

        public IQueryable<IdentificationType> IdentificationTypes
        {
            get 
            {
                return dbContext.IdentificationTypes;
            }
        }

        public void SaveIdentificationType(IdentificationType objIdentificationType)
        {
            if (objIdentificationType.Id == 0)
            {
                dbContext.IdentificationTypes.Add(objIdentificationType);
            }
            dbContext.SaveChanges();
        }

        public void DeleteIdentificationType(IdentificationType objIdentificationType)
        {
            dbContext.IdentificationTypes.Remove(objIdentificationType);
        }

        public IdentificationType GetIdentificationTypeById(int iIdentificationTypeId)
        {
            return dbContext.IdentificationTypes.Find(iIdentificationTypeId);
        }

        #endregion
    }
}
